<?php
namespace App\Model\Examples;

use PhalApi\Model\NotORMModel as NotORM;

/**
 *景点分类model
 */

class SpotType extends NotORM {

    protected function getTableName($id) {
        return 'spot_type';
    }

    /**
    *根据城市id获得首页景点分类
    *@cityid 城市id
    */
    public function getSpotTypeByID($cityid) {
        $total = $this->getORM()
            ->select('id,name,img')
            ->order('paixu ASC');
        return $total;
    }
    public function getList($page, $perpage) {
        return $this->getORM()
            ->select('*')
            ->limit(($page - 1) * $perpage, $perpage);
    }

    public function getListTotal() {
        $total = $this->getORM()
            ->count('id');

        return intval($total);
    }
}
